package thread.creadThread;

import lombok.extern.slf4j.Slf4j;

/**
 * @author ganbo
 * @date 2022/10/26 19:04
 */

@Slf4j
public class WaitDemo {

    final static Object o = new Object();

    public static void main(String[] args) throws InterruptedException {

        Thread t1 = new Thread(() -> {
            synchronized (o) {
                log.debug("执行。。。。");

                try {
                    o.wait(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                log.debug("其他.....");
            }

        }, "t1");

        t1.start();

        Thread.sleep(1000);

        System.out.println(t1.getState().name());


    }
}
